package top.superflow.service

import org.springframework.beans.factory.annotation.Autowired
import top.superflow.flow.manage.FlowManager
import top.superflow.lang.CollectionUtils

import scala.collection.mutable.ListBuffer

class FlowManagerAware {

  @Autowired
  protected var flowManager : FlowManager = _


  protected def toList[T](nestedMap : collection.Map[String, collection.Map[String, T]]) : ListBuffer[T] = {
    val list = ListBuffer[T]()

    if(CollectionUtils.isEmpty(nestedMap)){
      return list
    }

    nestedMap.values.foreach(value => {
      if(value != null){
        value.values.foreach(item => {
          list += item
        })
      }
    })

    list
  }

}
